<template>
  <div class="search">
    <el-card class="box-card">
      <div slot="header" class="clearfix search-header">
        <i class="el-icon-search"></i>
        <span>筛选搜索</span>
        <el-button 
        style="float: right; padding: 3px 0" type="primary"
        @click="getSearchList"
        >{{searchBtnText}}</el-button>
        <el-button 
        style="float: right; padding: 3px 0"  class="reset-btn" 
        v-if="isShowReset"
        @click="reset"
        >重置</el-button>
      </div>
      <div class="main">
        <slot></slot>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  name:"Search",
  props:{
    isShowReset:{
      type:Boolean,
      default:true
    },
    searchBtnText:{
      type:String,
      default:"查询结果"
    }
  },
  methods:{
    getSearchList(){
      this.$emit('getSreach')
    },
    reset(){
      this.$emit("reset")
    }
  }
}
</script>

<style scoped lang="less">
  .search{
    width: 98%;
    height: 200px;
    border: 1px solid #eee;
    margin: 10px auto;
    .box-card{
      width: 100%;
      height: 200px;
      .search-header{
        .el-icon-search{
          margin-right: 10px;
        }
        .el-button{
          width: 100px;
          height: 40px;
          margin-top: -10px;
        }
        .reset-btn{
          width: 60px;
          margin-right: 10px;
        }
      }
      .main{
        height: 160px;
        overflow: auto;
        &.main::-webkit-scrollbar{
          display: none;
        }
      }
    }    
  }
</style>